Optimal. Leaf size=285 \[ -\frac {b \left (6 a^3 b c d-6 a^4 d^2-a^2 b^2 \left (2 c^2-5 d^2\right )-b^4 \left (c^2+2 d^2\right )\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2} (b c-a d)^3 f}-\frac {2 d^3 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{(b c-a d)^3 \sqrt {c^2-d^2} f}+\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{2 \left (a^2-b^2\right )^2 (b c-a d)^2 f (a+b \sin (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.71, antiderivative size = 285, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 6, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {2881, 3134,
3080, 2739, 632, 210} \begin {gather*} \frac {b^2 \left (-5 a^2 d+3 a b c+2 b^2 d\right ) \cos (e+f x)}{2 f \left (a^2-b^2\right )^2 (b c-a d)^2 (a+b \sin (e+f x))}+\frac {b^2 \cos (e+f x)}{2 f \left (a^2-b^2\right ) (b c-a d) (a+b \sin (e+f x))^2}-\frac {b \left (-6 a^4 d^2+6 a^3 b c d-a^2 b^2 \left (2 c^2-5 d^2\right )-b^4 \left (c^2+2 d^2\right )\right ) \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (e+f x)\right )+b}{\sqrt {a^2-b^2}}\right )}{f \left (a^2-b^2\right )^{5/2} (b c-a d)^3}-\frac {2 d^3 \text {ArcTan}\left (\frac {c \tan \left (\frac {1}{2} (e+f x)\right )+d}{\sqrt {c^2-d^2}}\right )}{f \sqrt {c^2-d^2} (b c-a d)^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 2739
Rule 2881
Rule 3080
Rule 3134
Rubi steps
\begin {align*} \int \frac {1}{(a+b \sin (e+f x))^3 (c+d \sin (e+f x))} \, dx &=\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}-\frac {\int \frac {-2 \left (a b c-a^2 d+b^2 d\right )+b (b c-2 a d) \sin (e+f x)+b^2 d \sin ^2(e+f x)}{(a+b \sin (e+f x))^2 (c+d \sin (e+f x))} \, dx}{2 \left (a^2-b^2\right ) (b c-a d)}\\ &=\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{2 \left (a^2-b^2\right )^2 (b c-a d)^2 f (a+b \sin (e+f x))}+\frac {\int \frac {-4 a^3 b c d+a b^3 c d+2 a^4 d^2+2 a^2 b^2 \left (c^2-2 d^2\right )+b^4 \left (c^2+2 d^2\right )+b d \left (2 a^2 b c+b^3 c-4 a^3 d+a b^2 d\right ) \sin (e+f x)}{(a+b \sin (e+f x)) (c+d \sin (e+f x))} \, dx}{2 \left (a^2-b^2\right )^2 (b c-a d)^2}\\ &=\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{2 \left (a^2-b^2\right )^2 (b c-a d)^2 f (a+b \sin (e+f x))}-\frac {d^3 \int \frac {1}{c+d \sin (e+f x)} \, dx}{(b c-a d)^3}-\frac {\left (b \left (6 a^3 b c d-6 a^4 d^2-a^2 b^2 \left (2 c^2-5 d^2\right )-b^4 \left (c^2+2 d^2\right )\right )\right ) \int \frac {1}{a+b \sin (e+f x)} \, dx}{2 \left (a^2-b^2\right )^2 (b c-a d)^3}\\ &=\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{2 \left (a^2-b^2\right )^2 (b c-a d)^2 f (a+b \sin (e+f x))}-\frac {\left (2 d^3\right ) \text {Subst}\left (\int \frac {1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{(b c-a d)^3 f}-\frac {\left (b \left (6 a^3 b c d-6 a^4 d^2-a^2 b^2 \left (2 c^2-5 d^2\right )-b^4 \left (c^2+2 d^2\right )\right )\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{\left (a^2-b^2\right )^2 (b c-a d)^3 f}\\ &=\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{2 \left (a^2-b^2\right )^2 (b c-a d)^2 f (a+b \sin (e+f x))}+\frac {\left (4 d^3\right ) \text {Subst}\left (\int \frac {1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac {1}{2} (e+f x)\right )\right )}{(b c-a d)^3 f}+\frac {\left (2 b \left (6 a^3 b c d-6 a^4 d^2-a^2 b^2 \left (2 c^2-5 d^2\right )-b^4 \left (c^2+2 d^2\right )\right )\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (e+f x)\right )\right )}{\left (a^2-b^2\right )^2 (b c-a d)^3 f}\\ &=-\frac {b \left (6 a^3 b c d-6 a^4 d^2-a^2 b^2 \left (2 c^2-5 d^2\right )-b^4 \left (c^2+2 d^2\right )\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2} (b c-a d)^3 f}-\frac {2 d^3 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{(b c-a d)^3 \sqrt {c^2-d^2} f}+\frac {b^2 \cos (e+f x)}{2 \left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{2 \left (a^2-b^2\right )^2 (b c-a d)^2 f (a+b \sin (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.38, size = 275, normalized size = 0.96 \begin {gather*} \frac {-\frac {2 b \left (-6 a^3 b c d+6 a^4 d^2+a^2 b^2 \left (2 c^2-5 d^2\right )+b^4 \left (c^2+2 d^2\right )\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2} (-b c+a d)^3}+\frac {4 d^3 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{(-b c+a d)^3 \sqrt {c^2-d^2}}-\frac {b^2 \cos (e+f x)}{(a-b) (a+b) (-b c+a d) (a+b \sin (e+f x))^2}+\frac {b^2 \left (3 a b c-5 a^2 d+2 b^2 d\right ) \cos (e+f x)}{(a-b)^2 (a+b)^2 (b c-a d)^2 (a+b \sin (e+f x))}}{2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(624\) vs.
\(2(271)=542\).
time = 3.66, size = 625, normalized size = 2.19
method | result | size |
derivativedivides | \(\frac {-\frac {2 b \left (\frac {\frac {b^{2} \left (7 a^{4} d^{2}-12 a^{3} b c d +5 a^{2} b^{2} c^{2}-4 a^{2} b^{2} d^{2}+6 a \,b^{3} c d -2 b^{4} c^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) a}+\frac {b \left (6 a^{6} d^{2}-10 a^{5} b c d +4 a^{4} b^{2} c^{2}+9 a^{4} b^{2} d^{2}-16 a^{3} b^{3} c d +7 a^{2} b^{4} c^{2}-6 a^{2} b^{4} d^{2}+8 a \,b^{5} c d -2 b^{6} c^{2}\right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) a^{2}}+\frac {b^{2} \left (17 a^{4} d^{2}-28 a^{3} b c d +11 a^{2} b^{2} c^{2}-8 a^{2} b^{2} d^{2}+10 a \,b^{3} c d -2 b^{4} c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{2 a \left (a^{4}-2 a^{2} b^{2}+b^{4}\right )}+\frac {b \left (6 a^{4} d^{2}-10 a^{3} b c d +4 a^{2} b^{2} c^{2}-3 a^{2} b^{2} d^{2}+4 a \,b^{3} c d -b^{4} c^{2}\right )}{2 a^{4}-4 a^{2} b^{2}+2 b^{4}}}{\left (a \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+2 b \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+a \right )^{2}}+\frac {\left (6 a^{4} d^{2}-6 a^{3} b c d +2 a^{2} b^{2} c^{2}-5 a^{2} b^{2} d^{2}+b^{4} c^{2}+2 b^{4} d^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {a^{2}-b^{2}}}\right )}{\left (a d -b c \right )^{3}}+\frac {2 d^{3} \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{\left (a^{3} d^{3}-3 a^{2} b c \,d^{2}+3 a \,b^{2} c^{2} d -b^{3} c^{3}\right ) \sqrt {c^{2}-d^{2}}}}{f}\) | \(625\) |
default | \(\frac {-\frac {2 b \left (\frac {\frac {b^{2} \left (7 a^{4} d^{2}-12 a^{3} b c d +5 a^{2} b^{2} c^{2}-4 a^{2} b^{2} d^{2}+6 a \,b^{3} c d -2 b^{4} c^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) a}+\frac {b \left (6 a^{6} d^{2}-10 a^{5} b c d +4 a^{4} b^{2} c^{2}+9 a^{4} b^{2} d^{2}-16 a^{3} b^{3} c d +7 a^{2} b^{4} c^{2}-6 a^{2} b^{4} d^{2}+8 a \,b^{5} c d -2 b^{6} c^{2}\right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) a^{2}}+\frac {b^{2} \left (17 a^{4} d^{2}-28 a^{3} b c d +11 a^{2} b^{2} c^{2}-8 a^{2} b^{2} d^{2}+10 a \,b^{3} c d -2 b^{4} c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{2 a \left (a^{4}-2 a^{2} b^{2}+b^{4}\right )}+\frac {b \left (6 a^{4} d^{2}-10 a^{3} b c d +4 a^{2} b^{2} c^{2}-3 a^{2} b^{2} d^{2}+4 a \,b^{3} c d -b^{4} c^{2}\right )}{2 a^{4}-4 a^{2} b^{2}+2 b^{4}}}{\left (a \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+2 b \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+a \right )^{2}}+\frac {\left (6 a^{4} d^{2}-6 a^{3} b c d +2 a^{2} b^{2} c^{2}-5 a^{2} b^{2} d^{2}+b^{4} c^{2}+2 b^{4} d^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {a^{2}-b^{2}}}\right )}{\left (a d -b c \right )^{3}}+\frac {2 d^{3} \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{\left (a^{3} d^{3}-3 a^{2} b c \,d^{2}+3 a \,b^{2} c^{2} d -b^{3} c^{3}\right ) \sqrt {c^{2}-d^{2}}}}{f}\) | \(625\) |
risch | \(\text {Expression too large to display}\) | \(1603\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 788 vs.
\(2 (277) = 554\).
time = 0.53, size = 788, normalized size = 2.76 \begin {gather*} -\frac {\frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (c\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + d}{\sqrt {c^{2} - d^{2}}}\right )\right )} d^{3}}{{\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \sqrt {c^{2} - d^{2}}} - \frac {{\left (2 \, a^{2} b^{3} c^{2} + b^{5} c^{2} - 6 \, a^{3} b^{2} c d + 6 \, a^{4} b d^{2} - 5 \, a^{2} b^{3} d^{2} + 2 \, b^{5} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{4} b^{3} c^{3} - 2 \, a^{2} b^{5} c^{3} + b^{7} c^{3} - 3 \, a^{5} b^{2} c^{2} d + 6 \, a^{3} b^{4} c^{2} d - 3 \, a b^{6} c^{2} d + 3 \, a^{6} b c d^{2} - 6 \, a^{4} b^{3} c d^{2} + 3 \, a^{2} b^{5} c d^{2} - a^{7} d^{3} + 2 \, a^{5} b^{2} d^{3} - a^{3} b^{4} d^{3}\right )} \sqrt {a^{2} - b^{2}}} - \frac {5 \, a^{3} b^{4} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 2 \, a b^{6} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 7 \, a^{4} b^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 4 \, a^{2} b^{5} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 4 \, a^{4} b^{3} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 7 \, a^{2} b^{5} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, b^{7} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 6 \, a^{5} b^{2} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 9 \, a^{3} b^{4} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 6 \, a b^{6} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 11 \, a^{3} b^{4} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 2 \, a b^{6} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 17 \, a^{4} b^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 8 \, a^{2} b^{5} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 4 \, a^{4} b^{3} c - a^{2} b^{5} c - 6 \, a^{5} b^{2} d + 3 \, a^{3} b^{4} d}{{\left (a^{6} b^{2} c^{2} - 2 \, a^{4} b^{4} c^{2} + a^{2} b^{6} c^{2} - 2 \, a^{7} b c d + 4 \, a^{5} b^{3} c d - 2 \, a^{3} b^{5} c d + a^{8} d^{2} - 2 \, a^{6} b^{2} d^{2} + a^{4} b^{4} d^{2}\right )} {\left (a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a\right )}^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 30.17, size = 2500, normalized size = 8.77 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________